package ge.telasi.tasks.ui.comp;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;

/**
 * @author dimitri
 */
public class Hyperlink extends JLabel {

    public Hyperlink() {
        this(null);
    }

    public Hyperlink(String text) {
        setText(text);
        setForeground(Color.BLUE);
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        addMouseListener(new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                setForeground(Color.RED);
            }

            @Override
            public void mouseExited(MouseEvent e) {
                setForeground(Color.BLUE);
            }

            @Override
            public void mouseClicked(MouseEvent e) {
                onClick();
            }
        });
    }

    public void onClick() {
    }

}
